<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1"/>
    <meta http-equiv="X-UA-Compatible" content="IE=9"/>
    <title>字典管理</title>
    <script src="../js/vue/dist/vue.min.js"></script>
    <script src="../js/element-ui/lib/index.js"></script>
    <script src="../js/jquery-3.4.1.min.js"></script>
    <script src="../js/web-util.js"></script>
    <link rel="stylesheet" href="../js/element-ui/lib/theme-chalk/index.css">
    <style type="text/css">
        .el-row {
            margin-bottom: 20px;
        }

        .el-tree {
            border: 1px solid #DCDFE6;
            margin-right: 5px;
        }

        .el-main {
            padding: 0;
        }

        body {
            height: 85%;
            margin: 10px;
            background: #ffffff;
        }
    </style>
</head>
<body>
<div id="app">
    <template>
        <el-container>
            <el-aside style="width:500px;margin-right: 20px">
                <el-row>
                    <el-col :span="24">
                        <el-button type="primary" icon="el-icon-plus" @click="showTypeEditDialog" size="small">新增字典
                        </el-button>
                    </el-col>
                </el-row>

                <el-table ref="typeTable" v-loading="loading" @row-click="onTypeClick" :data="typeTable"
                          row-class-name="row_padding" header-row-class-name="head_padding" highlight-current-row border
                          style="width: 100%">
                    <el-table-column label="类型编码" prop="typeCode" align="center" header-align="center"
                                     show-overflow-tooltip></el-table-column>
                    <el-table-column label="类型名称" prop="typeName" align="center"
                                     show-overflow-tooltip></el-table-column>
                </el-table>
                <div style="text-align: right;margin-top: 8px;">
                    <el-pagination
                            @size-change="onTypeListSizeChange"
                            @current-change="onTypeListCurrentChange"
                            :current-page="typeQueryForm.current"
                            :page-sizes="[10, 50, 100]"
                            :page-size="typeQueryForm.size"
                            layout="total, sizes, prev, pager, next, jumper"
                            :total="typeQueryForm.total">
                    </el-pagination>
                </div>
            </el-aside>
            <el-main>
                <el-row>
                    <el-button type="primary" icon="el-icon-plus" @click="showDicEditDialog(null)" size="small">新增键值
                    </el-button>
                </el-row>

                <el-row>
                    <el-table ref="dictable" v-loading="loading" :data="dicTable" row-class-name="row_padding" header-row-class-name="head_padding" highlight-current-row border style="width: 100%">
                        <el-table-column label="key" prop="dicKey" align="center" header-align="center" show-overflow-tooltip></el-table-column>
                        <el-table-column label="value" prop="dicValue" align="center"></el-table-column>
                        <el-table-column label="状态" prop="businessFlag" align="center">
                            <template slot-scope="scope">
                                <span v-html="showBusinessStatusImage(scope.row.businessFlag)"></span>
                            </template>
                        </el-table-column>
                        <el-table-column label="操作" fixed="right" header-align="center" align="center">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="showDicEditDialog(scope.row)" type="text" size="small">
                                    编辑
                                </el-button>
                                <el-button @click.native.prevent="deleteDic(scope.row)" type="text" size="small">
                                    删除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-row>
            </el-main>
        </el-container>

        <el-dialog title="字典类型" :visible.sync="typeFormVisible" @close="onTypeFormDialogClosed" width="600px">
            <el-form ref="typeForm" :model="typeForm" :rules="typeFormRules" label-width="150px" label-position="right">
                <el-form-item label="类型编码" prop="typeCode" required>
                    <el-input v-model="typeForm.typeCode" placeholder="请输入类型编码" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item label="类型名称" prop="typeName" required>
                    <el-input v-model="typeForm.typeName" placeholder="请输入类型名称" style="width: 300px"
                              :maxlength="100"></el-input>
                </el-form-item>
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="typeForm.remark" type="textarea" :rows="3" placeholder="请填写相关描述"
                              style="width: 300px" :maxlength="50"></el-input>
                </el-form-item>
                <el-form-item label-width="0" style="text-align: center">
                    <el-button type="primary" @click="saveType()" size="small">保存</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <el-dialog title="字典键值" :visible.sync="dicformvisible" @close="onDicFormDialogClosed" width="600px">
            <el-form ref="dicform" :model="dicForm" :rules="dicFormRules" label-width="150px" label-position="right">
                <el-form-item label="Key" prop="dicKey" required>
                    <el-input v-model="dicForm.dicKey" placeholder="请输入Key" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item label="Value" prop="dicValue" required>
                    <el-input v-model="dicForm.dicValue" placeholder="请输入Value" style="width: 300px"
                              :maxlength="100"></el-input>
                </el-form-item>

                <el-form-item label="备注" prop="remark">
                    <el-input v-model="dicForm.remark" type="textarea" :rows="3" placeholder="请填写相关描述"
                              style="width: 300px" :maxlength="50"></el-input>
                </el-form-item>
                <el-form-item label-width="0" style="text-align: center">
                    <el-button type="primary" @click="saveDic()" size="small">保存</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

    </template>
</div>
</body>
<script src="Dictionary.js" type="text/javascript"></script>
</html>

